﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RPGProject.IOBuffers;
namespace RPGProject.GameWorld
{
    sealed partial class World
    {
        /// <summary>
        /// Renders the world state to the screen.
        /// </summary>
        /// <param name="forceRender">Forces the screen to rerender.</param>
        public void Render(bool forceRender = false)
        {
            CharInfo toAdd;
            for (int i = 0; i < (int)this["width"]; i++)
            {
                for (int j = 0; j < (int)this["height"]; j++)
                {
                    toAdd = new CharInfo(this.activeLevel[i][j].Icon, this.activeLevel[i][j].IconColor, this.backgroundLevel[i][j].background);
                    if (toAdd != this.outBuffer[i, j])
                        this.outBuffer[i, j] = toAdd;
                }
            }
            //this.screen.Render(forceRender);
        }

        /// <summary>
        /// Renders the big log.
        /// </summary>
        /// <param name="forceRender">Forces the big log to rerender.</param>
        public void RenderLog(bool forceRender = false)
        {
            this.bigLogBuffer.Render(forceRender);
        }
    }
}
